home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / tests / RCS / SubClass2.m,v < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.3 KB  |  115 lines

  1. head    1.1;
  2. access;
  3. symbols;
  4. locks
  5.     dglattin:1.1; strict;
  6. comment    @# @;
  7.  
  8.  
  9. 1.1
  10. date    92.08.18.04.58.04;    author dglattin;    state Exp;
  11. branches;
  12. next    ;
  13.  
  14.  
  15. desc
  16. @test code.
  17. @
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @#include  <assert.h>
  26. #include  <stdlib.h>
  27. #include  <strings.h>
  28. #include  <SubClass2.h>
  29.  
  30. #define THE_MESSAGE "Another test message"
  31.  
  32.  
  33. @@implementation SubClass2
  34.  
  35.  
  36. + initialize {
  37.  
  38.   printf( "If you see this message then SubClass2 received a"
  39.     " +initialize method\n" );
  40.   
  41.   return self;
  42. }
  43.  
  44.  
  45. + newOther {
  46.  
  47.   self = [ self new ];
  48.  
  49.   return self;
  50. }
  51.  
  52. - hokeyMethod {
  53.  
  54.  
  55.   return self;
  56. }
  57.  
  58.  
  59. - print {
  60.  
  61.  
  62.   printf( "SubClass2 print\n" );
  63.   
  64.   return self;
  65. }
  66.  
  67.  
  68. - print:( const char* )aPhrase {
  69.  
  70.  
  71.   printf( "SubClass2 print:%s\n", aPhrase );
  72.   
  73.   return self;
  74. }
  75.  
  76.  
  77. - print:( const char* )msg1 with:( const char* )msg2 {
  78.  
  79.  
  80.   printf( "SubClass2 print:with:, msg1=%s, msg2=%s\n", msg1, msg2 );
  81.   
  82.   return self;
  83. }
  84.  
  85.  
  86. - storeOn:( int )aFd {
  87.  
  88.   int len;
  89.   
  90.   
  91.   [ super storeOn:aFd ];
  92.   sprintf (dumb, THE_MESSAGE);
  93.   len = write (aFd, dumb, sizeof (dumb));
  94.   assert(len == sizeof (dumb));
  95.   
  96.   return self;
  97. }
  98.  
  99.  
  100. - readFrom:( int )aFd {
  101.  
  102.   int len;
  103.   
  104.   
  105.   [ super readFrom:aFd ];
  106.   len = read (aFd, dumb, sizeof (dumb));
  107.   assert(len == sizeof (dumb));
  108.   assert(!strcmp ( dumb, THE_MESSAGE));
  109.   
  110.   return self;
  111. }
  112.  
  113.  
  114. @@end@
  115.